def twosum_for(nums, target):
    n = len(nums)
    loop_dict = {}      # 用于标记的哈希字典
    for i in range(n):
        if target - nums[i] in loop_dict:   # 另外一个值
            # return loop_dict[target - nums[i]]+1, i+1  # 返回索引
            return target-nums[i], nums[i]    # 返回值
        loop_dict[nums[i]] = i    # 字典标记
 
 
print(twosum_for([2, 3, 7, 9, 4, 6], 12))
#sha1:df7d5fb7bdbb:d4b9431c9c5ce681a6e7aad3587589597e405f69
# 作者：gy_98 
# 来源：CSDN 
# 原文：https://blog.csdn.net/qq_42684307/article/details/90812505 
# 版权声明：本文为博主原创文章，转载请附上博文链接！
#
#
#/usr/bin/python3 -m pip install -U pylint --user
